<extend name="Layout/application"/>

<block name="content">
    <div class="row">
        <div class="col-md-12">

            <div class="row">
                <div class="col-md-8">
                    <div class="page-header">
                        <h1>内容管理</h1>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-md-10">
                    <div class="panel panel-default">
                        <a href="{{:U('create')}}">
                            <button type="button" class="btn btn-primary">新增栏目</button>
                        </a>


                        <a href="">
                            <button type="button" class="btn btn-primary">
                                删除栏目
                            </button>
                        </a>
                        <div class="panel-body">
                            <table class="table table-hover">
                                <thead>
                                <tr>
                                    <th>#</th>
                                    <th>名称</th>
                                    <th>排序</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>

                                <volist name="categories" id="category">
                                    <tr>
                                        <td>{{$category.id}}</td>
                                        <td>{{$category.name}}</td>
                                        <td><input type="text" value="{{$category.sort_order}}"></td>
                                        <td>
                                            <input type="hidden" name="id[]" value="{{$category.id}}">
                                            <a class="edit" href="" data-toggle="modal" data-target="#edit_link">
                                                <span class="glyphicon glyphicon-pencil"></span>
                                            </a>

                                            <a href="{{:U('destroy', array('id'=>$category['id']))}}">
                                                <span class="glyphicon glyphicon-trash"></span>
                                            </a>
                                        </td>
                                    </tr>
                                    <volist name="category.children" id="c">
                                        <tr>
                                            <td>{{$c.id}}</td>
                                            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{$c.name}}</td>
                                            <td><input type="text" value="{{$c.sort_order}}"></td>
                                            <td>
                                                <input type="hidden" name="id[]" value="{{$c.id}}">
                                                <a class="edit" href="" data-toggle="modal" data-target="#edit_link">
                                                    <span class="glyphicon glyphicon-pencil"></span>
                                                </a>

                                                <a href="{{:U('destroy', array('id'=>$c['id']))}}">
                                                    <span class="glyphicon glyphicon-trash"></span>
                                                </a>
                                            </td>
                                        </tr>

                                    </volist>

                                </volist>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>


                <div class="col-md-2">
                    <div class="list-group">
                        <a href="{{:U('create')}}" class="list-group-item list-group-item-info">
                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 新增 (add)
                        </a>

                        <a href="javascript: void 0;" class="list-group-item list-group-item-info sort_category">
                            <span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> 排序 (sort)
                        </a>
                    </div>

                </div>
            </div>
        </div>
    </div>
</block>